<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>职位</title>
  <style>
    .job-area {
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .job-block {
      width: 100%;
      margin-bottom: 30px;
      background-color: #fff;
      cursor: pointer;
    }

    .job-block .job-name,
    .job-block .job-company {
      padding-left: 10px;
    }

    .job-block .action {
      float: right;
      padding: 5px;
    }
  </style>
</head>

<body style="background-color: rgb(236, 231, 226);">
  <div class="job-area" id="job-area">
    <div class="job-block">
      <p class="job-name">java开发工程师</p>
      <p class="job-company" data-job-code="0010">A公司 B轮·500-2000人</p>
      <div class="action">
        <a href="##" data-action="job_collect">收藏</a>
        <a href="##" data-action="cv_send">投简历</a>
        <a href="##" data-action="cv_upload">上传简历</a>
      </div>
    </div>
    <div class="job-block">
      <p class="job-name">java开发工程师</p>
      <p class="job-company" data-job-code="0015">B公司 上市公司·500-2000人</p>
      <div class="action">
        <a href="##;" data-action="job_collect">收藏</a>
        <a href="##;" data-action="cv_send">投简历</a>
        <a href="##;" data-action="cv_upload">上传简历</a>
      </div>
    </div>
    <div class="job-block">
      <p class="job-name">java开发工程师</p>
      <p class="job-company" data-job-code="0020">C公司 C轮·150-500人</p>
      <div class="action">
        <a href="##;" data-action="job_collect">收藏</a>
        <a href="##;" data-action="cv_send">投简历</a>
        <a href="##;" data-action="cv_upload">上传简历</a>
      </div>
    </div>
  </div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script>
  $(function () {
    $('#job-area').on('click', e => {
      const nodeName = e.target.nodeName;
      const $target = $(e.target);
      console.log(nodeName);
      // 操作
      let action;
      // 对方企业编码
      let jobCode;
      if ('A' === nodeName) {
        action = $target.attr('data-action');
        jobCode = $target.parent().prev().attr('data-job-code');
      } else {
        action = 'click';
        if ($target.hasClass('job-block')) {
          jobCode = $target.find('p:eq(1)').attr('data-job-code');
        } else {
          jobCode = $target.parent().find('p:eq(1)').attr('data-job-code');
        }
      }

      const data = {
        user_id: 'user01',
        act_time: new Date().getTime(),
        action: action,
        jobCode: jobCode
      };
      console.log(data);
      $.ajax({
        type: 'POST',
        url: 'http://linux01/user/action',
        data: data,
        success: data => console.log(data)
      });
    })
  })
</script>

</html>